/*
	YoghurtGum - 2D Game Engine

	Copyright 2009-2011 Quinten Lansu
	
	Licensed under the Apache License, Version 2.0 (the "License"); you may not 
	use this file except in compliance with the License. You may obtain a copy 
	of the License at 
		
		http://www.apache.org/licenses/LICENSE-2.0 
		
	Unless required by applicable law or agreed to in writing, software 
	distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
	License for the specific language governing permissions and limitations 
	under the License. 
*/

#ifndef _ERROROPENGLES_H_
#define _ERROROPENGLES_H_

namespace YoghurtGum
{

	struct ErrorOpenGLES
	{

		static void Check(GLint a_Flag, const char* a_File, int a_Line)
		{
			switch (a_Flag)
			{
			case GL_INVALID_ENUM:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Invalid enum (GL_INVALID_ENUM) at line %i in file %s", a_Line, a_File);
				break;
			case GL_INVALID_VALUE:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Invalid value (GL_INVALID_VALUE) at line %i in file %s", a_Line, a_File);
				break;
			case GL_INVALID_OPERATION:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Invalid operation (GL_INVALID_OPERATION) at line %i in file %s", a_Line, a_File);
				break;
			case GL_STACK_OVERFLOW:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Stack overflow (GL_STACK_OVERFLOW) at line %i in file %s", a_Line, a_File);
				break;
			case GL_STACK_UNDERFLOW:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Stack underflow (GL_STACK_UNDERFLOW) at line %i in file %s", a_Line, a_File);
				break;
			case GL_OUT_OF_MEMORY:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Out of memory (GL_OUT_OF_MEMORY) at line %i in file %s", a_Line, a_File);
				break;
			default:
				Log::GetSingleton().Print("ERROR! OpenGL ES: Unknown error (0x%x) at line %i in file %s", a_Flag, a_Line, a_File);
				break;
			}
		}
	
	}; // class ErrorOpenGLES

}; // namespace YoghurtGum
	
#endif